<template>
  <div class="menu-button">
      <template v-for="(l, lindex) in compData.data.list" :key="l">
        <div class="menu-box">
          <div class="menu-item">
            <div class="badge" v-if="l.badge.show" :style="{ background: l.badge.bgColor, color: l.badge.color }">
              {{ l.badge.text }}
            </div>
            <sa-image :url="l.src" size="40" radius="0" :suffix="null"></sa-image>
            <div v-if="compData.data.layout == 1" class="title" :style="{ color: l.title.color }">
              {{ l.title.text }}
            </div>
          </div>
        </div>
      </template>

    <!-- <div class="indicator" v-if="compData.data.list.length > compData.data.row * compData.data.col">
      <sa-icon icon="sa-shop-decorate-imageBanner-indicator-1" size="30" />
    </div> -->
  </div>
</template>

<script setup>
const props = defineProps(['compData']);
</script>

<style lang="scss" scoped>
.menu-button::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.menu-button {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.menu-button {
  width: 375px;
  padding-bottom: 10px;
  overflow-x: scroll !important;
  white-space: nowrap;
  .menu-box {
    display: inline-block;
    height: 72px;
    min-width: 62.5px;
    width: 62.5px;
  }

  .menu-item {
    width: 62.5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 16px;
    // position: relative;
    margin: 6px 0 5px;

    .title {
      height: 16px;
      line-height: 16px;
      margin-top: 4px;
      font-size: 12px;
    }

    .badge {
      // position: absolute;
      top: 0;
      // left: 50%;
      z-index: 1;
      padding: 0 6px;
      height: 20px;
      line-height: 20px;
      font-size: 12px;
      text-align: center;
      border-radius: 6px 6px 6px 0;
    }
  }

  .indicator {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    :deep() {
      .sa-icon {
        color: #333;
      }
    }
  }
}
</style>
